/**
 * 
 */
package in.ac.nitw.imageProcessor;

import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;

/**
 * Converts an image to its equivalent grayscale image
 * 
 * @author kislay
 * 
 */
public class GrayScaleTransformer implements ImageTransformer {

    /*
     * (non-Javadoc)
     * 
     * @see
     * in.ac.nitw.imageProcessor.ImageTransformer#applyTransformation(java.awt
     * .image.BufferedImage)
     */
    @Override
    public BufferedImage applyTransformation(BufferedImage image) {
	ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
	ColorConvertOp op = new ColorConvertOp(cs, null);
	BufferedImage grayScale = op.filter(image, null);
	return grayScale;
    }

}
